﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using Microsoft.VSSDK.Tools.VsIdeTesting;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Tests.Integration.Instruments
{
    public class UIControlAction
    {
        private int delayMillisecond;

        private Action action;


        public UIControlAction(int delayMillisecond, Action action)
        {
            this.delayMillisecond = delayMillisecond;
            this.action = action;
        }


        public void PerformAction()
        {
            if (delayMillisecond > 0 && action != null)
            {
                Thread.Sleep(delayMillisecond);
                UIThreadInvoker.Invoke(action);
            }
        }
    }
}
